<script setup>
import HomePanel from './HomePanel.vue';
import { onMounted, ref } from 'vue'
import { getProductListService } from '@/api/Home'; 
const  productList = ref([])
const getProductList = async () => {
  const res = await getProductListService()
  productList.value = res.data.result
}
onMounted(()=>{
    getProductList()
})

</script>
<template>
         <HomePanel :title="item.name" v-for="item in productList" :key="item.id">
            <template #product>
                <div class="product">
                    <div class="left" >
                        <img v-imgLazy="item.picture" alt="" width="100%" height="100%"> 
                    </div>
                    <div class="right">
                        <ul>
                            <li v-for="item in item.goods" :key="item.id">
                                <a href="#">
                                <div class="img"><img v-imgLazy="item.picture" alt="" width="100%" height="100%"></div>
                                <p class="title ellipsis">{{ item.name }}</p>
                                <p class="txt ellipsis">{{ item.desc }}</p>
                                <span class="price">￥{{ item.price }}</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </template>
    </HomePanel>

</template>
<style scoped>
.hr{
    margin-top: 30px;
    height: 0px;
}
.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product{
    width: 1200px;
    height: 550px;
    background-color: #fff;
}
.left{
    float: left;
    width: 220px;
    height: 100%;
}
.right{
    float: right;
    width: 980px;
    height: 100%;
}
.right ul{
    border: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: space-between;
    margin-left: 30px;
    float: right;
    height: 100%;
}
.right ul li{
    width: 220px;
    height: 270px;
}
.right ul li a{
    width: 100%;
    height: 100%;
    display: block;
}
.right ul li a .img{
    width: 100%;
    height: 200px;
    background-color: green;
}
.right ul li a .title{
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    padding: 0 10px;
}
.right ul li a .txt{
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 0 10px;
}
.right ul li a .price{
    width: 100%;
    display: block;
    color: red;
    font-size: 15px;
    text-align: center;
    font-weight: 700;
}
.right ul li:hover{
    transform: translate(-5px);
    box-shadow: 0px -5px 20px #b7b3b3;
    transition: all .5s;
}
</style>